From de2550eb69d9f11cdee9c5ac380797bdfd17bd22 Mon Sep 17 00:00:00 2001 From: tsteven4 <13596209+tsteven4@users.noreply.github.com> Date: Mon, 15 Mar 2021 14:32:54 -0600 Subject: [PATCH] make some Qt containers const. (#705) This avoids checks for detachment. --- mynav.cc | 2 +- pcx.cc | 6 ++---- shape.cc | 2 +- xcsv.cc | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/mynav.cc b/mynav.cc index 95a614ac2..9643daeea 100644 --- a/mynav.cc +++ b/mynav.cc @@ -41,7 +41,7 @@ void MyNavFormat::read_line(const QString& line, route_head* track) { - QStringList fields = line.split("|"); + const QStringList fields = line.split('|'); if (global_opts.debug_level > 1) { qDebug() << "line: " << line; diff --git a/pcx.cc b/pcx.cc index 8b53970c7..e9658d7f1 100644 --- a/pcx.cc +++ b/pcx.cc @@ -132,8 +132,7 @@ static void data_read() { switch (ibuf[0]) { case 'W': { - QStringList tokens = - line.split(sep); + const QStringList tokens = line.split(sep); if (tokens.size() < 6) { fatal(MYNAME ": Unable to parse waypoint, not all required columns " @@ -232,8 +231,7 @@ static void data_read() { route_add_head(route); break; case 'T': { - QStringList tokens = - line.split(sep); + const QStringList tokens = line.split(sep); if (tokens.size() < 6) { fatal(MYNAME ": Unable to parse trackpoint, not all required columns " diff --git a/shape.cc b/shape.cc index 3fe7ba670..1c732153c 100644 --- a/shape.cc +++ b/shape.cc @@ -218,7 +218,7 @@ ShapeFormat::read() if (qopt_name.contains('+')) { // form a compound name from one or more fields. nameidx = -2; - QStringList opt_name_fields = qopt_name.split('+', QString::SkipEmptyParts); + const QStringList opt_name_fields = qopt_name.split('+', QString::SkipEmptyParts); nameindices.reserve(opt_name_fields.size()); for (int oidx=0; oidx